package com.example.helloandroid;


import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;


public class HelloReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        doTestShowOnNotification(context);
    }

    void doTestShowOnNotification(Context context) {
        //Log.i(TAG," In on receive" + intent.getAction());

        boolean isTablet = true;//SetupUtility.isTabletFlow();
        Notification.Builder builder = new Notification.Builder(context);
        builder.setTicker("Error");
        builder.setContentTitle("title_text");
        builder.setContentText("Press here to view");
        builder.setContentIntent( PendingIntent.getActivity(context, 0,
                          new Intent().setClassName(context, "com.example.helloandroid.TosActivity"), 0));
        builder.setSmallIcon(R.drawable.icon);

        if (isTablet/*SetupUtility.isTabletFlow()*/) {
            builder.setOngoing(true);
            builder.setAutoCancel(false);
        }
        else {
            builder.setAutoCancel(true);
        }
        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(PRIVACY_NOTIFICATION_ID, builder.getNotification());        
    }
    public static final int PRIVACY_NOTIFICATION_ID = 102;        
}
